package com.shujia.method_.seven;

public class MethodDemo1 {

    // 形参的传递, 值传递
    public static void main(String[] args) {
        /*
        int a = 5;
        int b = 6;

        0000 0101
        0000 0110

        a = a ^ b;
        b = a ^ b; -> b = a ^ b ^ b; b = a;
        a = a ^ b; -> a = a ^ b ^ a; a = b;
        System.out.println(a);
        System.out.println(b);

        a ^ b ^ b = a; // 对同一个数异或两次结果是它本身
        0000 0101 ^
        0000 0110

        0000 0011 ^
        0000 0110
        0000 0101
         */
        int a = 5;
        int b = 6;

        a = a ^ b;
        b = a ^ b;
        a = a ^ b;
        System.out.println(a);
        System.out.println(b);
    }

}
